package com.nbicc.attachments.po;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.Objects;

/**
 * @Author: lilingyan
 */
@ApiModel(value="附件描述" , description = "附件的元数据")
@Data
public class Attachment {

    @ApiModelProperty(value="附件唯一id")
    @JsonSerialize(using= ToStringSerializer.class)
    private long id;
    @ApiModelProperty(value="文件名")
    private String name;
    @ApiModelProperty(value="文件大小")
    private Long size;
    @ApiModelProperty(value="对应文件系统中的文件id" , notes = "对前台无意")
    private Long fileId;
    @ApiModelProperty(value="创建时间")
    private Date createTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Attachment that = (Attachment) o;
        return id == that.id;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), id);
    }
}
